/**
 * (created at 2011-1-25)
 */
package qiushuo.mysqlparser.ast.fragment.tableref;

import java.sql.SQLSyntaxErrorException;
import java.util.ArrayList;
import java.util.List;

import qiushuo.mysqlparser.generator.SQLType;

/**
 * used in <code>FROM</code> fragment
 * 
 * @author <a href="mailto:QiuShuo1985@gmail.com">QIU Shuo</a>
 */
public class TableReferences implements TableReference {
    protected static List<TableReference> ensureListType(List<TableReference> list) {
        if (list instanceof ArrayList) return list;
        return new ArrayList<TableReference>(list);
    }

    private final List<TableReference> list;

    public TableReferences(List<TableReference> list) throws SQLSyntaxErrorException {
        if (list == null || list.size() <= 0) {
            throw new SQLSyntaxErrorException("at least one table reference");
        }
        this.list = ensureListType(list);
    }

    @Override
    public String generateSql(SQLType type) {
        // QS_TODO gen sql
        throw new UnsupportedOperationException("not implemented yet");
    }
}
